package com.ianmoone.JZOF;

import java.util.Scanner;

public class XunLeiTest1 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int maxNum = scanner.nextInt();
		int count = 0;
		for (int i = 0; i < maxNum; i++) {
			for (int j = i; j < maxNum; j++) {
				for (int k = j+1; k < maxNum; k++) {
					if ((i*i + j*j == k*k)) {
						if (checkPrime(i, j) && checkPrime(i, k) && checkPrime(j, k)) {
							count++;
						}
					}
				}
			}
		}
		System.out.println(count);
	}
	
	private static boolean checkPrime(int i,int j){
		int a = j;
		int b = i;
		int temp =0;
		while((temp = a % b)!=0){
			a = b;
			b = temp;
		}
		if(b ==0){
			return false;
		}else {
			return true;
		}
	}
}
